package com.etc.dao.impl;
import java.sql.ResultSet;
import java.util.ArrayList;
/**
 * @author Amber
 */
import java.util.List;

import com.etc.dao.LanguagesDao;
import com.etc.entity.Languages;
import com.etc.util.DBUtil;

public class LanguagesDaoImpl implements LanguagesDao{

	@Override
	public List<Languages> findAll() {
		List<Languages> list = new ArrayList<Languages>();
		ResultSet rs = DBUtil.query("SELECT languages_id,languages_name FROM languages");
		try {
			while (rs.next()) {
				Integer languagesId = rs.getInt("languages_id");
				String languagesName = rs.getString("languages_name");
				
				Languages languages= new Languages();
				languages.setLanguagesId(languagesId);
				languages.setLanguagesName(languagesName);
				
				list.add(languages);
			}
		} catch (Exception e) {
			// TODO: handle exception
			e.printStackTrace();
		}
		return list;
	}

}
